﻿using System;
using System.IO;
using System.Reflection;

namespace WebCrawler
{
    public interface IFileManager
    {
        void CreateFile(string fileName, string text);
    }

    public class FileManager : IFileManager
    {
        public void CreateFile(string fileName, string text)
        {
            var path = AppDomain.CurrentDomain.BaseDirectory;
            var fullName = Path.Combine(path, fileName);
            var dir = Path.GetDirectoryName(fullName);
            Directory.CreateDirectory(dir);
            File.AppendAllText(fullName, text);
        }
    }
}